<script setup>
import HelloWorld from './components/HelloWorld.vue'
import TheWelcome from './components/TheWelcome.vue'
import {reactive} from "vue";

let num = 0
const addNum = () => {
  num++
  console.log(num)
}
// 响应式对像
const state = reactive({
  count: 0
})
const addCount = () => {
  state.count++
  console.log(state.count)
}

// export default {
//   data() {
//     return {
//       num: 0,
//     }
//   },
//   methods: {
//     addNum() {
//       this.num++
//     }
//   }
// }
</script>

<template>
  <div>{{ num }}</div>
  <div @click="addNum" style="padding: 5px 10px;">addNum++</div>
  <div>{{ state.count }}</div>
  <div @click="addCount" style="padding: 5px 10px;">addCount++</div>

  <header>
    <img alt="Vue logo" class="logo" src="./assets/logo.svg" width="125" height="125"/>


    <div class="wrapper">
      <HelloWorld msg="You did it!"/>
    </div>
  </header>

  <main>
    <TheWelcome/>
  </main>
</template>

<style scoped>
header {
  line-height: 1.5;
}

.logo {
  display: block;
  margin: 0 auto 2rem;
}

@media (min-width: 1024px) {
  header {
    display: flex;
    place-items: center;
    padding-right: calc(var(--section-gap) / 2);
  }

  .logo {
    margin: 0 2rem 0 0;
  }

  header .wrapper {
    display: flex;
    place-items: flex-start;
    flex-wrap: wrap;
  }
}
</style>
